Debian 9 Stretch
Sponsored Link

Docker : Install
2017/08/03
 
Install Docker which is the Operating System-Level Virtualization Tool, which automates the deployment of applications inside Containers.
[1] Install Docker.
root@dlp:~#
apt -y install apt-transport-https ca-certificates software-properties-common
root@dlp:~#
wget https://download.docker.com/linux/debian/gpg

root@dlp:~#
apt-key add gpg

OK
root@dlp:~#
add-apt-repository "deb https://download.docker.com/linux/debian stretch stable"

root@dlp:~#
apt update

root@dlp:~#
apt install docker-ce
root@dlp:~#
systemctl start docker

root@dlp:~#
systemctl enable docker

[2] Download an official image and create a Container and output the words [Welcome to the Docker World] inside the Container.
# download the image

root@dlp:~#
docker pull debian
# run echo inside Container

root@dlp:~#
docker run debian /bin/echo "Welcome to the Docker World!"

Welcome to the Docker World!
[3] Connect to the interactive session of a Container with [i] and [t] option like follows. If exit from the Container session, the process of a Container finishes.
root@dlp:~#
docker run -it debian /bin/bash

root@b1a3e647c900:/#    
# Container's console
root@b1a3e647c900:/#
exit

exit
root@dlp:~#    
# back
[4] If exit from the Container session with keeping container's process, push [Ctrl+p] and [Ctrl+q] key.
root@dlp:~#
docker run -it debian /bin/bash

root@ba8481569c85:/# root@dlp:~#    
# Ctrl+p, Ctrl+q
# show docker process

root@dlp:~#
docker ps

CONTAINER ID  IMAGE    COMMAND       CREATED         STATUS         PORTS   NAMES
ba8481569c85  debian   "/bin/bash"   29 seconds ago  Up 28 seconds          eager_snyder

# connect to container's session

root@dlp:~#
docker attach ba8481569c85

root@ba8481569c85:/#
# shutdown container's process from Host's console

root@dlp:~#
docker kill ba8481569c85

ba8481569c85
root@dlp:~#
docker ps

CONTAINER ID     IMAGE           COMMAND      CREATED          STATUS          PORTS     NAMES
 
Tweet